<?php
/**
 * Pertyler DatabaseManagement
 * DatabaseModel
 * Row Abstract Class
 *
 * @author	Emre Hasegeli <hasegeli@gmail.com>
 * @license	GNU General Public License v3
 */

namespace Pertyler;

abstract class aRow
{
	protected $table;

	private	$id;

	protected $name;

	public function __construct(Table $table,
			$id,
			$name)
	{
		$this->table = $table;

		$this->id = $id;

		$this->name = $name;
	}

	public function Id()
	{
		return $this->id;
	}

	public function __ToString()
	{
		return $this->name;
	}

	public function VirtualRow()
	{
		if(is_numeric($this->id))
			return false;

		return true;
	}

	public function SelectParent()
	{
		return $this->table->SelectRowsParentRow($this);
	}
}
